/*
 *    Copyright 2009 Simone Tripodi
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.googlecode.memos2;

import java.net.InetSocketAddress;
import java.util.List;
import java.util.concurrent.TimeUnit;

import net.spy.memcached.ConnectionFactory;

/**
 * The Memcached client configuration.
 *
 * @author Simone Tripodi (simone.tripodi)
 * @version $Id: MemcachedConfiguration.java 164 2010-06-05 15:34:35Z simone.tripodi $
 */
final class MemcachedConfiguration {

    /**
     * The key prefix.
     */
    private String keyPrefix;

    /**
     * The Connection Factory used to establish the connection to Memcached
     * server(s).
     */
    private ConnectionFactory connectionFactory;

    /**
     * The Memcached servers.
     */
    private List<InetSocketAddress> addresses;

    /**
     * Encrypt keys flag.
     */
    private boolean encryptKeys;

    /**
     * The flag to switch from sync to async Memcached get.
     */
    private boolean usingAsyncGet;

    /**
     * Compression enabled flag.
     */
    private boolean compressionEnabled;

    /**
     * The Memcached entries expiration time.
     */
    private int expiration;

    /**
     * The Memcached connection timeout when using async get.
     */
    private int timeout;

    /**
     * The Memcached timeout unit when using async get.
     */
    private TimeUnit timeUnit;

    public String getKeyPrefix() {
        return keyPrefix;
    }

    public void setKeyPrefix(String keyPrefix) {
        this.keyPrefix = keyPrefix;
    }

    public ConnectionFactory getConnectionFactory() {
        return connectionFactory;
    }

    public void setConnectionFactory(ConnectionFactory connectionFactory) {
        this.connectionFactory = connectionFactory;
    }

    public List<InetSocketAddress> getAddresses() {
        return addresses;
    }

    public void setAddresses(List<InetSocketAddress> addresses) {
        this.addresses = addresses;
    }

    public boolean isEncryptKeys() {
        return encryptKeys;
    }

    public void setEncryptKeys(boolean encryptKeys) {
        this.encryptKeys = encryptKeys;
    }

    public boolean isUsingAsyncGet() {
        return usingAsyncGet;
    }

    public void setUsingAsyncGet(boolean usingAsyncGet) {
        this.usingAsyncGet = usingAsyncGet;
    }

    public boolean isCompressionEnabled() {
        return compressionEnabled;
    }

    public void setCompressionEnabled(boolean compressionEnabled) {
        this.compressionEnabled = compressionEnabled;
    }

    public int getExpiration() {
        return expiration;
    }

    public void setExpiration(int expiration) {
        this.expiration = expiration;
    }

    public int getTimeout() {
        return timeout;
    }

    public void setTimeout(int timeout) {
        this.timeout = timeout;
    }

    public TimeUnit getTimeUnit() {
        return timeUnit;
    }

    public void setTimeUnit(TimeUnit timeUnit) {
        this.timeUnit = timeUnit;
    }

}
